package com.bflow.web.controller;

import com.bflow.api.IBflowDefineActService;
import com.bflow.api.IBflowExtResService;
import com.bflow.api.bo.BflowDefineActBo;
import com.bflow.api.bo.BflowDefineActQueryParam;
import com.bflow.api.bo.ext.BflowRoleBo;
import com.bflow.api.bo.ext.BflowUserBo;
import com.bflow.commons.bean.PageResult;
import com.bflow.commons.bean.TableQuery;
import com.bflow.commons.bean.TableResult;
import com.bflow.commons.consts.CommConst;
import com.bflow.util.JsonUtil;
import com.bflow.web.util.RequestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;

/**
 * @Name 活动
 * @Author haowen
 * @Date 2018-12-13
 */
@Controller
@RequestMapping(value = "/bflow/extRes/")
public class BflowExtResController extends BflowBaseController {

    @Autowired
    private IBflowExtResService bflowExtResService;

    @RequestMapping(value = "getUserList")
    @ResponseBody
    public String list(BflowUserBo paramBo, TableQuery query,HttpServletRequest req, HttpServletResponse resp) {
        try {
            PageResult<BflowUserBo>  pageResult = bflowExtResService.findUserList(null);
            return JsonUtil.toStr(pageResult.getResult());
        } catch (Exception e) {
            return returnFail(e, "列表查询失败");
        }
    }

    @RequestMapping(value = "getUserSelectList")
    @ResponseBody
    public String getUserSelectList(HttpServletRequest req, HttpServletResponse resp) {
        try {
            PageResult<BflowUserBo>  pageResult = bflowExtResService.findUserList(null);
            return returnOk(pageResult.getResult(), "查询成功");
        } catch (Exception e) {
            return returnFail(e, "查询失败");
        }
    }


    @RequestMapping(value = "getRoleSelectList")
    @ResponseBody
    public String getRoleSelectList(HttpServletRequest req, HttpServletResponse resp) {
        try {
            PageResult<BflowRoleBo>  pageResult = bflowExtResService.findRoleList(null);
            return returnOk(pageResult.getResult(), "查询成功");
        } catch (Exception e) {
            return returnFail(e, "查询失败");
        }
    }


}
